<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
  <title>登录</title>
  <link rel="icon" href="http://www.wclimb.site/images/avatar.png">
	<script src="https://unpkg.com/jquery@3.3.1/dist/jquery.min.js"></script>
</head>
<bod>
    <div>home</div>
    <div class='list' id='list'>
      
    </div>
    <div>
      <a href='/setArticle'>写文章</a>
    </div>
  
</bod>
</html>
<script>
  $(function(){
			
				$.ajax({
          url: "/article/list",
          data: {
            name: $('input[name=name]').val(),
            password:$('input[name=password]').val()
					},
					type: "GET",
					cache: false,
					dataType: 'json',
					success: function (result) {
            var str = ''
            for(var i=0;i<result.data.data.length;i++){
              str += `
                  <div>
                      <span>文章id：${result.data.data[i].id}</span>
                      <span>文章名：${result.data.data[i].name}</span>
                      <span>文章内容：${result.data.data[i].content}</span>
                      <span>创建时间：${result.data.data[i].moment}</span>
                  </div>
                `
            }
            const list = document.getElementById('list');
            list.innerHTML = str
					},
					error: function (error) {
            alert('异常');
            console.log('success',error)
					}
				})
		})
</script>